import { Dayjs } from 'dayjs';
export interface SearchInfo {
  userId?: number;
  orderNumber?: string;
  totalAmount?: number;
  status?: string;
  paymentMethod?: string;
  paymentTime?: Dayjs | string;
  orderDescription?: string;
  source?: string;
  keyword?: string;
}

export interface pageInfo {
  current?: number;
  pageSize?: number;
  total?: number;
  showTotal: Function;
  showSizeChanger: boolean;
  pageSizeOptions: string[];
  showSizeChange: Function;
  size: string;
  showQuickJumper: boolean;
  defaultPageSize: number;
}

export let pagination = ref<any>({
  // 数据总数
  total: 0,
  // 当前页数
  current: 1,
  // 每页条数
  pageSize: 10,
  // 展示总数
  showTotal: (total: number) => `共 ${total} 条`,
  // 是否可以改变pageSize
  showSizeChanger: true,
  // 设置每页可以展示多少条的选项
  pageSizeOptions: ['10', '20', '50', '100'],
  // 改变pageSize后触发
  showSizeChange: (current: number, pageSize: any) => (
    (pagination.value.current = current), (pagination.value.pageSize = pageSize)
  ),
  // 小尺寸分页
  size: 'small',
  // 是否可以快速跳转至某页
  showQuickJumper: true,
  //默认条数
  defaultPageSize: 10,
});

export const columns = ref<any>([
  {
    title: '用户编码',
    dataIndex: 'code',
    key: 'code',
  },
  {
    title: '用户电话',
    dataIndex: 'phone',
    key: 'phone',
  },
  {
    title: '订单编号',
    dataIndex: 'orderNumber',
    key: 'orderNumber',
  },
  {
    title: '订单总金额',
    dataIndex: 'totalAmount',
    width: '110px',
    key: 'totalAmount',
  },
  {
    title: '订单类型',
    dataIndex: 'type',
    key: 'type',
  },
  {
    title: '订单状态',
    dataIndex: 'status',
    key: 'status',
  },
  {
    title: '支付时间',
    dataIndex: 'paymentTime',
    key: 'paymentTime',
  },
  {
    title: '备注',
    dataIndex: 'orderDescription',
    key: 'orderDescription',
  },
  {
    title: '操作',
    key: 'operation',
    fixed: 'right',
    width: '160px',
  },
]);


export interface DataItem {
  userId: number;
  orderNumber: string;
  totalAmount: number;
  status: string;
  paymentMethod: string;
  paymentTime?: Dayjs | string;
  orderDescription: string;
}

export interface ModelInfo {
  title?: string;
  width?: string;
  id?: number | undefined;
  confirmLoading?: boolean;
}

export interface dictInfo {
  typeCode?: string | number | undefined,
  typeName?: string | undefined,
}

export const labelMap = {
  keyword: { name: 'keyword', label: '编码/电话' },
  orderNumber: { name: 'orderNumber', label: '订单编号' },
  totalAmount: { name: 'totalAmount', label: '订单总金额' },
  status: { name: 'status', label: '订单状态' },
  paymentMethod: { name: 'paymentMethod', label: '支付方式' },
  paymentTime: { name: 'paymentTime', label: '支付时间' },
  orderDescription: { name: 'orderDescription', label: '订单描述或备注' },
};

export const getTypeName = (type: string) => {
  switch (type) {
    case 'parnter':
    case 'partner':
      return '办理合伙人';
    case 'membership':
      return '办理会员';
    case 'payBalance':
      return '支付余额';
    case 'create_dating':
    case 'create_dating_top':
      return '创建约会';
    case 'join_dating':
      return '加入约会';
    case 'matchmaker_save':
      return '保存红娘信息';
    default:
      return type;
  }
};

